using System.Collections.Generic;

namespace LDNS.Models
{
    /// <summary>
    /// DNS服务配置模型
    /// 作者：huobing
    /// </summary>
    public class DnsServiceConfig
    {
        /// <summary>
        /// DNS服务端口
        /// </summary>
        public int Port { get; set; } = 53;
        
        /// <summary>
        /// 是否启用DNS缓存
        /// </summary>
        public bool EnableCache { get; set; } = true;
        
        /// <summary>
        /// 上游DNS服务器列表
        /// </summary>
        public List<string> UpstreamDnsServers { get; set; } =
        [
            "8.8.8.8", 
            "8.8.4.4", 
            "1.1.1.1", 
            "1.0.0.1" 
        ];
        /// <summary>
        /// DNS缓存过期时间（分钟）
        /// </summary>
        public int CacheExpirationMinutes { get; set; } = 60;
        
        /// <summary>
        /// 是否启用记录持久化
        /// </summary>
        public bool EnableRecordPersistence { get; set; } = true;
        
        /// <summary>
        /// 记录文件路径（用于存储所有DNS记录）
        /// </summary>
        public string RecordFilePath { get; set; } = "Conf/dns.conf";
        
        /// <summary>
        /// 是否启用DNS服务
        /// </summary>
        public bool IsEnabled { get; set; } = true;
        
        /// <summary>
        /// 最大连接数
        /// </summary>
        public int MaxConnections { get; set; } = 100;
        
        /// <summary>
        /// 是否启用Socket管理
        /// </summary>
        public bool EnableSocketManagement { get; set; } = false;
        
        /// <summary>
        /// Socket管理端口
        /// </summary>
        public int SocketManagementPort { get; set; } = 8053;
        
        /// <summary>
        /// 是否启用访问控制
        /// </summary>
        public bool EnableAccessControl { get; set; } = false;
        
        /// <summary>
        /// 允许访问的IP列表（支持单个IP、CIDR 或 IP段，如 192.168.1.0/24 或 192.168.1.10-192.168.1.20）
        /// </summary>
        public List<string> AllowedIPs { get; set; } = ["127.0.0.1"];
        
        /// <summary>
        /// 命名管道名称
        /// </summary>
        public string PipeName { get; set; } = "LDNSPipe";
        
        /// <summary>
        /// dns记录配置文件监控间隔（秒）
        /// </summary>
        public int DnsRecordConfigWatchInterval { get; set; } = 30;
        
        /// <summary>
        /// 默认DNS记录TTL（秒）
        /// </summary>
        public int DefaultRecordTtl { get; set; } = 3600;
    }
}